<template>
  <div class="component simple_dialog">
    <el-dialog ref="_simpleDialog" v-bind="proxy.$attrs">
      <template #header>
        <div class="sd_title">
          <slot name="header"></slot>
        </div>
      </template>
      <template #default>
        <div class="sd_content">
          <slot name="default"></slot>
        </div>
      </template>
      <template #footer>
        <div class="sd_footer">
          <slot name="footer"></slot>
        </div>
      </template>
    </el-dialog>
  </div>
</template>

<script lang="ts" setup>
const _simpleDialog = ref()
const { proxy }: any = getCurrentInstance()
onMounted(() => {
  for (const [key, value] of Object.entries(_simpleDialog.value)) {
    if(key) proxy[key] = value
  }
})
</script>

<style lang="less" scoped>
.simple_dialog {
  :deep(.el-dialog) {
    .el-dialog__header {
      padding: 10px 20px;
      margin: 0;
      .sd_title {
        width: 100%;
        height: 40px;
        line-height: 40px;
        > span {
          display: inline-block;
          width: auto;
          min-width: 80px;
          height: 100%;
          text-align: center;
          font-size: 13px;
        }
      }
    }
    .sd_content {
      width: 72%;
      margin: 0 auto;
      .el-input {
        width: 100%;
      }
      .el-select {
        width: 100%;
      }
    }
    .el-dialog__footer {
      .sd_footer {
        width: 100%;
        height: 40px;
        line-height: 40px;
        flex-flow: row nowrap;
        justify-content: flex-end;
        align-items: center;
      }
    }
  }
}
</style>
